package com.bwie.es;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * 优惠券领取记录表
 * @TableName tb_coupon_record
 */
@Document(indexName = "es_record",shards = 1,replicas = 0)
@Data
public class EsCouponRecord implements Serializable {
    /**
     * 记录ID
     */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer recordId;

    /**
     * 创建人
     */
    @Field(type = FieldType.Text,index = false)
    private String createBy;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    private Date createTime;

    /**
     * 更新人
     */
    @Field(type = FieldType.Text,index = false)
    private String updateBy;

    /**
     * 更新时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    private Date updateTime;

    /**
     * 领取人
     */
    @Field(type = FieldType.Keyword)
    private Integer userId;

    /**
     * 优惠券ID
     */
    @Field(type = FieldType.Keyword)
    private Integer couponId;

    /**
     * 使用时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    private Date useTime;

    /**
     * 生效时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    private Date beginTime;

    /**
     * 过期时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    private Date engTime;

    /**
     * 使用状态;0：未使用 1：已使用
     */
    @Field(type = FieldType.Keyword)
    private Integer used;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    @TableField(exist = false)
    private String couponName;

    @Field(type = FieldType.Keyword,index = false)
    @TableField(exist = false)
    private String userName;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}